import request from '../index'
import type { IAccount } from './type'

enum LoginAPI {
  AccountLoginAPI = '/login',
  UserInfoAPI = '/users/',
  RoleMenusAPI = '/role/'
}

export function accountLoginRequest(account: IAccount) {
  return request.post({
    url: LoginAPI.AccountLoginAPI,
    data: account
  })
}

export function getUserInfoRequest(id: number) {
  return request.get({
    url: LoginAPI.UserInfoAPI + id
  })
}

export function getRoleMenusRequest(roleId: number) {
  return request.get({
    url: LoginAPI.RoleMenusAPI + roleId + '/menu'
  })
}
